﻿@model BusinessManagementStudio.ViewModel.OrderInvoiceView
@using System.Globalization

@{
    ViewBag.Title = "JLL-(ORDER) Invoice";
    TempData.Keep();
}

<title>Invoice</title>

@using (Html.BeginForm())
{
    @Html.ValidationSummary(true)

    <table align="center">
        <tr>
            <td></td>
            <td></td>
            <td width="300"></td>
            <td width="150" align="right">Invoice No. :</td>
            <td align="right">@Html.DisplayFor(m => m.CompletedOrder.InvoiceNo)</td>
        </tr>
        <tr>
            <td></td>
            <td></td>
            <td width="300"></td>
            <td width="150" align="right">Quotation No. :</td>
            <td align="right">@Html.DisplayFor(m => m.CompletedOrder.QuotationNo)</td>
        </tr>
        <tr>
            <td></td>
            <td></td>
            <td width="300"></td>
            <td width="150" align="right">Work Order No. :</td>
            <td align="right">@Html.DisplayFor(m => m.CompletedOrder.WorkOrderNo)</td>
        </tr>
        <tr>
            <td></td>
            <td></td>
            <td width="300"></td>
            <td width="150" align="right">Date :</td>
            <td align="right">@Html.DisplayFor(m => m.CompletedOrder.InvoiceCreationDate, "{0:yyyy-MM-dd}")</td>
        </tr>
        <tr>
            <td></td>
            <td></td>
            <td width="300"></td>
            <td width="150" align="right">Ref :</td>
            <td align="right">@Html.DisplayFor(m => m.CompletedOrder.ServiceOrderNo)</td>
        </tr>
        <tr>
            <td width="50" align="right">RE :</td>
            <td align="left">@Html.DisplayFor(m => m.CompletedOrder.Location, new { style = "width:300px" })</td>
            <td width="300"></td>
            <td width="150" align="right">Vendor No. :</td>
            <td align="right">@Html.DisplayFor(m => m.CompletedOrder.VendorNo)</td>
        </tr>
        <tr>
            <td></td>
            <td align="left">@Html.DisplayFor(m => m.ServiceDetail, new { style = "width:300px" })</td>
            <td width="300"></td>
            <td width="150" align="right"></td>
            <td align="right"></td>
        </tr>
    </table>
    
    <br align="center"/>
    <table align="center" border="1">
        <thead>
            <tr>
                <th width="30">Item</th>
                <th width="400">Description</th>
                <th width="80">SOR Item</th>
                <th width="40">Qty</th>
                <th width="40">Unit</th>
                <th width="80">Rate</th>
                <th width="80">Amount (HKD)</th>
            </tr>
        </thead>
        <tbody>
            @foreach (var item in Model.JllQuotation)
            {
                <tr>
                    @if(item.ItemNo != 0)
                    { 
                        <td>@item.ItemNo</td>
                    }
                    else
                    {
                        <td></td>
                    }
                    <td>@item.Description</td>
                    <td>@item.SORItem</td>
                    @if(item.Qty != 0)
                    { 
                        <td>@item.Qty</td>
                    }
                    else
                    {
                        <td></td>
                    }
                    <td>@item.Unit</td>
                    @if(item.Rate != 0)
                    { 
                        <td>@item.Rate</td>
                    }
                    else
                    {
                        <td></td>
                    }
                    @if(item.Amount != 0)
                    { 
                        <td>@item.Amount</td>
                    }
                    else
                    {
                        <td></td>
                    }
                </tr>
            }
        </tbody>
    </table>
    
    <br align="center"/>
    <table align="center">
        <tr>
            <td width="150" align="right">Work Completion</td>
            @*<td align="right">@Html.DisplayFor(m => m.invoice.WorkCompletionDate, "{0:dd-MMMM-yyyy}")</td>*@
            <td align="right">@Model.WorkCompletionDate.ToString("dd-MMMM-yyyy", CultureInfo.CreateSpecificCulture("en-US"))</td>
            <td width="300"></td>
            <td width="150" align="right">Total Amount (HKD)</td>
            <td align="right">$@Html.DisplayFor(m => m.TotalAmount)</td>
        </tr>
    </table>
    
    <br align="center"/>
    <div align="center">
        @*<button type="submit" name="Command" value="ExportToExcel">Export To Excel</button>
    <button type="submit" name="Command" value="ExportToPDF">Export To PDF</button>
    <button type="submit" name="Command" value="Close">Close</button>*@
    </div>
    
    
}


